home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / WebObjects / WebObjectsDoc_HTML / Reuse / ReusableComponentsEx / Application.wos < prev   
Encoding:
Text File  |  1996-03-11  |  1.8 KB  |  64 lines

  1. /////////////////////////////////////
  2. //  Application (ReusableCompoenents)
  3. //  by Charles Lloyd
  4. //////////////////////////////////////
  5.  
  6. id componentNames;
  7. id TheDescriptionTables;
  8.  
  9. ////////////////////////////
  10. // PathForResource
  11. ////////////////////////////
  12. - _pathForResource:aResourceName ofType:anExtension 
  13.     inComponentWithName:aComponentName
  14. {
  15.     // This will handle the obsolete code problem when Beta one is over.
  16.     // This is a convenient method, so I'll keep it.
  17.     id aResourcePath = [NSString stringWithFormat:@"%@.wo/%@", 
  18.     aComponentName, aResourceName];
  19.     aResourcePath = [WOApp pathForResource:aResourcePath ofType:anExtension];
  20.     return aResourcePath;
  21. }
  22.  
  23. ////////////////////////////
  24. // Description Table Access
  25. ////////////////////////////
  26. - _descriptionsForComponentNamed:aComponentName
  27. {
  28.     id aFilePathName = [self _pathForResource:@"Description" ofType:@"plist"
  29.     inComponentWithName:aComponentName];
  30.     id aString = [NSString stringWithContentsOfFile:aFilePathName];
  31.  
  32.     id aDescriptionTable = [aString propertyList];
  33.     return aDescriptionTable;
  34. }
  35.  
  36. - descriptionsForComponentNamed:aComponentName
  37. {
  38.     id aDescriptionTable = [TheDescriptionTables objectForKey:aComponentName];
  39.     if (!aDescriptionTable) {
  40.     aDescriptionTable = [self _descriptionsForComponentNamed: 
  41.         aComponentName];
  42.     [TheDescriptionTables setObject:aDescriptionTable 
  43.         forKey:aComponentName];
  44.     }
  45.     return aDescriptionTable;
  46. }
  47.  
  48. - awake 
  49. {
  50.     TheDescriptionTables = [NSMutableDictionary dictionary];
  51.     [WOApp setSessionTimeOut:10.0];
  52. }
  53.  
  54. - willGenerateResponse:aResponse inContext:aContext
  55. {
  56.     // This is is for NeXT internal servers only.
  57.     // All other servers will ignore.
  58.     id d;
  59.  
  60.     d=[NSMutableDictionary dictionaryWithDictionary: [aResponse headers]];
  61.     [d setObject:@"True" forKey:@"dshttpd-NoAutomaticFooter"];
  62.     [aResponse setHeaders: d];
  63. }
  64.